﻿<form name="myForm">
    <div class="control-group" ng-class="{error: myForm.name.$invalid && !myForm.name.$pristine}">
        <label>Name</label>
        <input type="text" name="name" ng-model="editProject.project.name" required>
        <span ng-show="myForm.name.$error.required && !myForm.name.$pristine" class="help-inline">
            Required {{myForm.name.$pristine}}
        </span>
    </div>

    <div class="control-group" ng-class="{error: myForm.site.$invalid && !myForm.site.$pristine}">
        <label>Website</label>
        <input type="url" name="site" ng-model="editProject.project.site" required>
        <span ng-show="myForm.site.$error.required && !myForm.site.$pristine" class="help-inline">
            Required
        </span>
        <span ng-show="myForm.site.$error.url" class="help-inline">
            Not a URL
        </span>
    </div>

    <label>Description</label>
    <textarea name="description" ng-model="editProject.project.description"></textarea>

    <br>
    <a href="#/" class="btn">Cancel</a>
    <button ng-click="editProject.save()" ng-disabled="myForm.$invalid"
            class="btn btn-primary">
        Save
    </button>
    <button ng-click="editProject.destroy()"
            ng-show="editProject.project.$id" class="btn btn-danger">
        Delete
    </button>
</form>